package b面向对象.day1.demo3;

public class Test {
    public static void main1(String[] args) {
        Person p=new Person();
        Account a=new Account();
        a.bankName="招行";
        a.money=1000;
        p.a=a;
        p.name="张三";
        p.queryMoney();

        //产生一个atm机
        Atm atm=new Atm();
        atm.bankName="贱行";
        p.saveMoney(100,atm);
        p.queryMoney();

        System.out.println("=======================");
        p.getMoney(1100,atm);
        p.queryMoney();

        Account other =new Account();
        p.tranferMoney(100,atm,other);
    }

    public static void main(String[] args) {
        Atm atm=new Atm();
        atm.bankName="招行";

        Person p1=new Person();
        p1.name="张三";
        p1.a=new Account();
        p1.a.money=1000;
        p1.a.bankName="招行";


        Person p2=new Person();
        p2.name="李四";
        p2.a=new Account();
        p2.a.money=2000;
        p2.a.bankName="农行";

        p1.tranferMoney(100,atm,p2.a);
        p1.queryMoney();
        p2.queryMoney();

    }
}
